import React,{useEffect, useState, useRef} from 'react';  
import {StyleSheet,Platform} from 'react-native';
import Headers from '@/Components/header/Headers';
import {
    Text,
    View,
    TouchableOpacity,
    Colors,
    Constants,
    Icon,
  } from 'react-native-ui-lib';
import {size} from '@/utils';
import ImageScreen from '@/Components/Image/ImageScreen'
// import {init,Geolocation} from 'react-native-amap-geolocation'
// import { AMapSdk,MapView,MapType } from "react-native-amap3d";
import { getLocationWhenInUsePermissions } from '@/utils/selectImg'
import {pTx} from '@/utils/size';

let ScanCodeScreen = (props:any)=>{
    let mapViewRef = useRef(null);

    function goBack(){
        props.navigation.goBack();
    }

    let [dingwei,setDingwei] = useState({
        longitude:116.37296,
        latitude:39.91095}
    );

    // let [dingwei,setDingwei] = useState({
    //     longitude:116.37296,
    //     latitude:39.91095}
    // );

    function getDingWei(){
        // init({
        //     ios: "dfbd77ca3e67c614c4eadd13470e216b",
        //     android: "f4991d4f80ab761f7afcf5b1c0ba08ef",
        // }).then(ress=>{
        //     console.log('ress------:',ress);
        //     getLocationWhenInUsePermissions().then(res=>{
        //         Geolocation.getCurrentPosition(({coords})=>{
        //             console.log(coords);
        //             setDingwei({longitude:coords.longitude,latitude:coords.latitude})
        //             console.log({longitude:coords.longitude,latitude:coords.latitude});
        //             mapViewRef.current.moveCamera({
        //                 tilt:0,
        //                 bearing:0,
        //                 zoom:18,
        //                 target:{longitude:coords.longitude,latitude:coords.latitude}
        //             })
        //         })
        //     })
        // }).catch(err=>{
        //     console.log('err------:',err);
        // });
    }

    useEffect(()=>{
        // AMapSdk.init(
        //     Platform.select({
        //         android:'f4991d4f80ab761f7afcf5b1c0ba08ef',
        //         ios:'dfbd77ca3e67c614c4eadd13470e216b'
        //     })
        // )
        getDingWei();
    },[])

    useEffect(()=>{
        
    },[]);

    return(
        <>
         <View>
            <Text>测试</Text>
         </View>
        </>
    )
};

const styles = StyleSheet.create({
    loginOutBtn:{
        width:'100%',
        backgroundColor:"#fff",
        height:size(50),
        marginTop:size(20),
        borderRadius:size(5)
    },
    oginOutBtn:{
        width:'100%',
        backgroundColor:"#fff",
        height:size(50),
        marginTop:size(20),
        borderRadius:size(5)
    },
    loginOutBtnText:{
        lineHeight:size(50),
        textAlign:'center'
    },
    contentBoxTop:{
        marginTop:size(20)
    },
    roundedDialog: {
        backgroundColor: Colors.white,
        marginBottom: Constants.isIphoneX ? 0 : size(20),
        borderRadius: size(12)
    },
    backBtn:{
        backgroundColor:'rgba(0,0,0,0.4)',
        width:size(24),
        height:size(24),
        borderRadius:size(25),
        flexDirection:'column',
        alignItems:'center',
        justifyContent:'center'
    },
    LoadingPage: {
        flex:1,
        justifyContent: "center",
        alignItems: "center",
    },
    barcodeTextURL: {
        fontSize:size(20),
        color: 'white',
        fontWeight: 'bold',
    },
    backBtnColor:{
        color: '#fff',
        backgroundColor:'transparent'
    },
    backBtnTextColor:{
        color: '#333',
        fontWeight:'600'
    }
})

export default ScanCodeScreen;

